﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lanbt.Core.Entity.Verification
{
    /// <summary>
    /// 验证是否是时间类型
    /// </summary>
    public class IsDateTimeAttribute : ValidationAttribute
    {
        public override bool IsValid(object? value)
        {
            if (value != null && value.ToString().Length > 0)
            {
                return DateTime.TryParse(value.ToString(), out DateTime dt);
            }
            return true;
        }
    }
}
